<template>
  <view>
    <scroll-view :scroll-top="scrollTop" scroll-x="true" class="scroll-Y" style="white-space: nowrap; background: #fff">
      <view class="" style="display: flex; align-items: center; background: #fff; height: 170rpx; margin-left: 36rpx">
        <view :class="current == k ? 'on1' : 'on'" v-for="(i, k) in list" :key="k" style="margin-right: 30rpx" @tap="(current = k), cases()">
          <view class="" style="font-size: 28rpx">
            {{ i.patient_name }}
          </view>
          <view class="" style="font-size: 24rpx">{{ i.patient_gender_text }} · {{ i.patient_age }}岁</view>
        </view>
      </view>
    </scroll-view>
    <view class="flex flex-wrap padding-sm">
      <view v-for="(item, index) in case_list" :key="index" style="width: 50%" @tap="util.urlTo('casedetail?id=' + item.id)" class="flex justify-center margin-bottom-sm">
        <view class="relative" style="position: relative; width: 334upx; height: 190upx">
          <image src="https://wenzhen.jiangkukeji360.com/static/casebg.png" mode="" style="width: 334upx; height: 190upx"></image>
          <view class="absolute-all padding-sm text-left" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%">
            <view class="text-1">我的病历 · {{ item.department_name }}</view>
            <view class="margin-top-xs text666">
              {{ item.inquiry_time }}
            </view>
            <view class="text-bold text-lg margin-top text-1">
              {{ item.patient_name }}
            </view>
          </view>
        </view>
      </view>
    </view>
    <!-- <view class="padding-bottom-xl foot-box text-center">
			<button class="cu-btn mybtn w500 round bgblue" @tap="util.urlTo('case_add?id='+id)">帮助上传</button>
		</view> -->
  </view>
</template>

<script>
export default {
  data() {
    return {
      id: null,
      list: [],
      current: 0,
      case_list: []
    };
  },
  methods: {
    // getCaseList
    cases() {
      this.api({
        url: '/api/doctor/getCaseList',
        method: 'post',
        data: {
          patient_id: this.list[this.current].patient_id
        }
      }).then((res) => {
        this.case_list = res.data.data;
      });
      // this.util.request('/api/patient/getCaseList',{
      // 	// patient_id:this.id
      // }).then(res=>{
      // 	this.list=res.data
      // })
    },
    oss() {
      this.api({
        url: '/api/index/patientList',
        method: 'post'
      }).then((res) => {
        this.list = res.data;
        this.case();
      });
    }
  },
  onLoad(op) {
    // this.id=op.id
    this.oss();
  },
  onShow() {}
};
</script>

<style>
page {
  padding-bottom: 80px;
}
.on {
  padding: 21rpx 53rpx 15rpx 25rpx;
  background: #f0f0f0;
  border-radius: 20rpx;
}

.on1 {
  padding: 21rpx 53rpx 15rpx 25rpx;

  background: linear-gradient(0deg, #1a9eff 0%, #0fb8ff 100%);
  border-radius: 20rpx;
  color: #fff;
}
</style>
